package com.tencent.sr.iris.basic.saas.service.model;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.tencent.sr.iris.activity.interfaces.response.group.GroupTaskBoardResponse;
import com.tencent.sr.iris.basic.saas.common.enums.IrisAuditStatusEnum;
import com.tencent.sr.iris.basic.saas.common.enums.IrisTaskStatusEnum;
import com.tencent.sr.iris.basic.saas.common.enums.IrisTaskTypeEnum;
import com.tencent.sr.iris.basic.saas.common.utils.CommonUtils;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

@Data
@ApiModel(value = "团长任务列表导出信息")
@Slf4j
@ColumnWidth(15)
public class GroupTaskBoardExportInfo {

    @ExcelProperty(value = "序号", index = 0)
    private int num;
    /**
     * 1=邀新有礼，3=GMV冲刺赛，4=销量冲刺赛
     */
    @ExcelProperty(value = "任务类型", index = 1)
    private String taskTargetEvaluation;

    @ExcelProperty(value = "任务报名时间", index = 2)
    private String taskPhaseJoinTime;

    @ExcelProperty(value = "任务名称", index = 3)
    private String taskPhaseName;

    @ExcelProperty(value = "任务开始时间", index = 4)
    private String taskPhaseStartTime;

    @ExcelProperty(value = "任务结束时间", index = 5)
    private String taskPhaseEndTime;

    /**
     * 1=准备中, 2=待上线，3=已上线，4=已下线，5=已作废
     */
    @ExcelProperty(value = "任务状态", index = 6)
    private String taskPhaseStatus;

    @ExcelProperty(value = "预估奖励金", index = 7)
    private Double predictAwardAmount;

    @ExcelProperty(value = "实际奖励金", index = 8)
    private Double awardAmount;

    /**
     * (0.待审核 1.未完成,2审核中,3.审批驳回,4.审核通过)
     */
    @ExcelProperty(value = "审核状态", index = 9)
    private String auditStatus;

    public void readFromSearchResponseData(GroupTaskBoardResponse response) {
        this.setTaskTargetEvaluation(IrisTaskTypeEnum.getByType(response.getTaskTargetEvaluation()));
        this.setTaskPhaseJoinTime(response.getTaskPhaseJoinTime());
        this.setTaskPhaseName(response.getTaskPhaseName());
        this.setTaskPhaseStartTime(response.getTaskPhaseStartTime());
        this.setTaskPhaseEndTime(response.getTaskPhaseEndTime());
        this.setTaskPhaseStatus(IrisTaskStatusEnum.getByStatus(response.getTaskPhaseStatus()));
        this.setPredictAwardAmount(CommonUtils.longToDouble(response.getPredictAwardAmount()));
        this.setAwardAmount(CommonUtils.longToDouble(response.getAwardAmount()));
        this.setAuditStatus(IrisAuditStatusEnum.getByStatus(response.getAuditStatus()));
    }

}
